import request from '@/utils/request'

/**
 * 获取用户频道，可以不登录
 * @returns promise
 */
export const getChannelList = () => {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}

/**
 * 获取所有频道
 * @returns
 */
export const getAllChannelList = () => {
  return request({
    method: 'get',
    url: '/v1_0/channels'
  })
}

/**
 * 添加频道
 * @param {*} channels 要添加频道的id和seq seq => 频道的顺序
 * @returns
 */
export function addChannel (channels) {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}
/**
 * 删除频道
 * @param {*} id 要删除的频道id
 * @returns
 */
export function delChannel (id) {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${id}`
  })
}
